<template>
  <div class="box">
    <div class="header">
      <van-nav-bar
        title="我的"
        left-text="返回"
        left-arrow
        @click-left="$router.push()"
      />
    </div>
    <div class="main">
       <div class="user">
        <p>用户名:{{username}}</p>
        <van-button type="primary" @click="loginout">退出登录</van-button>
       </div>
    </div>
  </div>
</template>

<script setup>

import {useRouter} from 'vue-router'
const router = useRouter()
const username= localStorage.getItem('username')
const loginout=()=>{
    localStorage.removeItem('token')
      localStorage.removeItem('username')
      router.push('/')
}

</script>



<style lang="scss" scoped>
.user{
    display: flex;
    justify-content: space-between;
}
</style>